import React from 'react'
import { WeaInputNumber } from 'ecCom';

export default class DevInputNumber extends React.Component{
  constructor(props){
    super(props)
    this.state={
      value : this.props.value || 0
    }
  }

  inputChange = (value) => {
    this.setState({value:value});
    if (typeof this.props.onChange === 'function') {
      this.props.onChange(value);
    }else{
      console.log('inputChange:',value);
    }
  }

  render(){
    return(
       <WeaInputNumber 
            value = {this.state.value}
            name = {this.props.name}
            precision = {this.props.precision}
            onChange = {this.inputChange}
        />
    )
  }
}